﻿<Window x:Class="Refugees.Views.Windows.News"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Refugees.Views.Windows"
        mc:Ignorable="d"
        Title="Новости" Height="450" Width="800">
    <Grid>
        <Grid.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF819B3D" Offset="0.061"/>
                    <GradientStop Color="#FF4A6A68" Offset="0.217"/>
                </LinearGradientBrush>
            </Grid.Background>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition Height="0.1*"/>
                <RowDefinition Height="0.2*"/>
                <RowDefinition/>
            </Grid.RowDefinitions>

        <Menu Grid.Row="0" HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <UniformGrid Rows="1"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <MenuItem HorizontalAlignment="Stretch" Header="Новости"  FontSize="20" FontWeight="Bold" HorizontalContentAlignment="Center" Click="NewsClick" FontFamily="Times New Roman"/>
            <MenuItem HorizontalAlignment="Stretch"  Header="Услуги"  FontSize="20" FontWeight="Bold" FontFamily="Times New Roman" Click="UsliguClick"/>
            <MenuItem HorizontalAlignment="Stretch"  Header="" FontSize="20"  FontWeight="Bold" FontStyle="Italic"/>
            <MenuItem HorizontalAlignment="Stretch"  Header="Организации" Click="ContactsClick" FontSize="20"  FontWeight="Bold" FontFamily="Times New Roman"/>
            <MenuItem HorizontalAlignment="Stretch"  Header="Пользователь"  FontSize="20" FontWeight="Bold" FontFamily="Times New Roman" Click="UserClick" />
        </Menu>
        <Ellipse HorizontalAlignment="Center" VerticalAlignment="Top" 
                 Margin="0, 20, 0, 0"
                 Width="100" Height="50" Grid.RowSpan="2">
                <Ellipse.Fill>
                    <ImageBrush Stretch="UniformToFill" ImageSource="/Icon/сердцепомощи.jpg"/>
                </Ellipse.Fill>
            </Ellipse>

            <Label Content="Kind Hend" 
               Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Bottom"
                   Foreground="Black"
                   FontSize="36" FontStyle="Italic" 
                   FontWeight="Bold" FontFamily="Perpetua Titling MT"/>

        <Button x:Name="Add" Click="AddClick" Content="Добавить новость" Style="{DynamicResource Vhod}" Grid.Row="1" Width="230" HorizontalAlignment="Right" Margin="0 0 15 0"/>
        <Grid Grid.Row="2">
            <ListBox Name="NewsItems" Background="{x:Null}" d:ItemsSource="{d:SampleData ItemCount=5}" BorderBrush="{x:Null}">
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="HorizontalAlignment" Value="Stretch"/>
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                    </Style>
                </ListBox.ItemContainerStyle>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate >
                    <DataTemplate >
                        <Grid >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="2*"/>
                            </Grid.ColumnDefinitions>

                            <Grid Grid.Column="1">
                                <Image Width="150" Height="120" Margin="15"  >
                                    <Image.Source>
                                        <Binding Path="ImageNews">
                                            <Binding.TargetNullValue>
                                                <ImageSource>/Icon/сердцепомощи.jpg</ImageSource>
                                            </Binding.TargetNullValue>
                                        </Binding>
                                    </Image.Source>
                                </Image>
                            </Grid>

                            <Grid Grid.Column="0">
                                <TextBlock TextWrapping="Wrap">
                         <Run Text="{Binding TitleNews}" FontSize="20" FontWeight="Bold"/>
                        <LineBreak/>
                         <Run Text="{Binding DescriptionNews}"  FontSize="15" FontWeight="Bold"/>
                                    <LineBreak/>
                                    <Run Text="{Binding DatePublication, StringFormat=dd/MM/yyyy}"/>
                                </TextBlock>
                            </Grid>

                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Grid>
</Window>
